package proyecto.testcasetool.presentation.editor.pages;


import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.DetailsPart;
import org.eclipse.ui.forms.IDetailsPage;
import org.eclipse.ui.forms.IDetailsPageProvider;

import proyecto.testcasetool.Scenario;
import proyecto.testcasetool.presentation.details.scenario.ScenarioDetailsPage;


public class MasterDetailsBlockScenarios extends AbstractMasterDetailsBlock {

	
	/**
	 * Default constructor. 
	 * The block is orientable.
	 */
	public MasterDetailsBlockScenarios() {
		super();
	}


	/**
	 * {@inheritDoc}
	 * @see org.eclipse.emf.eef.runtime.ui.widgets.masterdetails.AbstractEEFMasterDetailsBlock#createMasterPart(org.eclipse.swt.widgets.Composite)
	 */
	protected AbstractMasterPart createMasterPart(Composite masterContainer) {
		MasterPartScenarios masterPart = new MasterPartScenarios(toolkit, masterContainer, this);
		return masterPart;
	}
	
	
	protected void registerPages(DetailsPart detailsPart) {
		detailsPart.setPageProvider(new IDetailsPageProvider() {

			public Object getPageKey(Object object) {
				return object;
			}

			public IDetailsPage getPage(Object key) {
				if(key instanceof Scenario){
					lastDetailsPage = new ScenarioDetailsPage(toolkit, editingDomain, getAdapterFactory());
					return lastDetailsPage;
				}
				return null;
			}
		});
		
	}


}

